import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useAuthStore = defineStore('auth', () => {
  const token = ref('')
  const userInfo = ref({})

  const logout = () => {
    token.value = ''
    userInfo.value = {}
  }
  return { token, userInfo, logout }
}, {
  // persist: true // 开启当前模块的持久化
  persist: {
    key: 'auth', // 修改本地存储的唯一标识
  }
})
